<?php

$nome =  $_POST['dsnome'];
$login = $_POST['dslogin'];
$senha = $_POST['dssenha'];
$email_envio = $_POST['dsemail'];

require("../lib/phpmailer/class.phpmailer.php");
require("../lib/phpmailer/class.smtp.php");
//require("class.phpmailer.php");

		$mail = new PHPMailer(); 
		$mail->IsSMTP(); 
		$mail->Port = 465; 
		$mail->Host = 'smtp.gmail.com'; 
		$mail->IsHTML(true); 
		$mail->Mailer = 'smtp'; 
		$mail->SMTPSecure = 'ssl'; 
		//$mail->SMTPSecure = 'tls';
		$mail->SMTPAuth = true; 
		$mail->Username = "teste.cetil@gmail.com"; 
		$mail->Password = "casinha1"; 
		$mail->SingleTo = true;
		//$from = $this -> "rv.thiagovieira@gmail.com";
		//$fromname = $this -> "thiago";
		
		$mail->From = "nasket.inc@gmail.com"; // Seu e-mail
		$mail->FromName = "Handel"; // Seu nome
		
		$mail->IsHTML(true);
		$mail->CharSet = 'iso-8859-1';
				
		$body = "<!DOCTYPE html>";
		$body .= "<html>";		
		$body .= "<head>";
		$body .= "<title>Handel</title>";
		$body .= "</head>";		
		$body .= "<body>";
		$body .= "<fieldset style='background-color:#07162E'>";
		$body .= "<p><img src='https://lh4.googleusercontent.com/-wdG0MRrR734/VX15141Za2I/AAAAAAAAAH0/RoXtBQgS6pU/w189-h48-no/imagem_email.png'></img></p>";
		$body .= "<p style='color:white'><b>Caro(a) <i><u>".$nome."</u></i></b></p>";		
		$body .= "<p style='color:white'> Seja muito bem vindo(a) ao Handel. </p>";
		$body .= "<fieldset style='background-color:#CCCCCC'>";
		
		$body .= "<p><b> Utilize as seguintes informa&ccedil;&otilde;es de acesso:</b> </p>";
		$body .= "<p><b> Usuario: <i><u>".$login."</u></i></b></p>";
		$body .= "<p><b> Senha: <i><u>".$senha."</u></i></b></p>";
		
		$body .= "         <div>  ";
		$body .= "            <p>Este e-mail foi enviado para ".$email_envio.". </p>";
		$body .= "            <p>Voc&ecirc; est&aacute; recebendo este e-mail porque voc&ecirc; &eacute; um membro registrado do handel.com.</p>";
		$body .= "            <p>Leia nossa Pol&iacute;tica de Privacidade e Termos de Uso se voc&ecirc; tiver quaisquer perguntas.</p>";
		$body .= "            <p>Handel Service Center: nasket.inc@gmail.com</p>";
		$body .= "            <p>Att, HANDEL</p>";
		$body .= "         </div>";
		
		
		$body .= "</fieldset>";
		$body .= "</fieldset>";
		$body .= "</body>";
		$body .= "</html>";		
				
		/*$body = "<!DOCTYPE html>";
		$body .= "<html>";
		$body .= "<head>";
		$body .= "<title>Page Title</title>";
		$body .= "</head>";
		$body .= "<body>";
        $body .= "<img src='https://lh4.googleusercontent.com/-wdG0MRrR734/VX15141Za2I/AAAAAAAAAH0/RoXtBQgS6pU/w189-h48-no/imagem_email.png'></img>";
		$body .= "<h4>Caro(a) ".$nome."</h4>";
		$body .= "<div>";
		$body .= "<p> Seja muito bem vindo(a) ao Handel. </p>";
		$body .= "<hr>";
		$body .= "</div>";
		$body .= "<div>";
		$body .= "<b> Utilize as seguintes informações de acesso:</b> </br> </br>";
		$body .= "<p> Usuario: ".$login."</p>";
		$body .= "<p> Senha: ".$senha."</p>";
		$body .= "<hr>";
		$body .= "</div>";
        $body .= "";
		$body .= "</body>";
		$body .= "</html>";
			*/
				
		$mail->addAddress($email_envio);
		$mail->Subject = "Bem-Vindo";
		$mail->Body = $body; //"MENSAGEM";
		$result = $mail->Send();
		if($result){
			echo 'Email enviado com Sucesso!';
		}
		else{
			echo 'Erro ao enviar email!  '. $mail->ErrorInfo;
		}
?>